<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="decorator" content="mainframe" />
<title>参赛选手管理</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugins/datepicker/WdatePicker.js"></script>
</head>
<body>
	<section class="content-header">
		<h1>
			参赛选手<small>新增/修改</small>
		</h1>
		<ol class="breadcrumb">
			<li><a href="#"><i class="fa fa-dashboard"></i>参赛选手新增/修改</a></li>
			<!-- <li class="active">Here</li> -->
		</ol>
	</section>
	<!-- Main content -->
	<section class="content">
		<div class="box   box-default">
			<div class="box-header">
				<form class="form-horizontal" role="form" id="agentUserForm" method="post" action="<%=path%>/player/playerSave">
<%-- 				<form class="form-horizontal" role="form" id="agentUserForm" method="post" action="<%=path%>/agentUser/${agentUser.agentUserId==null?"add":"update"}"> --%>
					<div class="form-group">
						<label for="loginName" class="col-sm-2 control-label"><font color="red">*</font>姓名</label>
						<div class="input-group col-sm-5">
							<input type="text" class="form-control" id="agentNo" name="agentNo" placeholder="请输入玩家真实姓名" value="王宁">
						</div>
					</div>
					<div class="form-group">
						<label for="nickName" class="col-sm-2 control-label"><font color="red">*</font>国别</label>
						<div class="input-group col-sm-5">
							<input type="text" class="form-control" id="agentUserName" name="agentUserName" placeholder="请输入玩家国籍" value="中国">
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label"><font color="red">*</font>生日</label>
						<div class="input-group col-sm-5">
							<input type="text" class="form-control input-sm" id="addTime" readonly name="addTimeEnd" placeholder="玩家生日"
									<%-- value="<fmt:formatDate value='1990-10-01' pattern='yyyy-MM-dd'/>" --%>
									onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})">
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label"><font color="red">*</font>游戏昵称</label>
						<div class="input-group col-sm-5">
							<input type="text" class="form-control" id="agentUserName" name="agentUserName" placeholder="请输入玩家的游戏昵称" value="stom_宁">
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label"><font color="red">*</font>所在游戏</label>
						<div class="input-group col-sm-5">
							<select class="form-control selectpicker show-tick" name="skillGroupId">
								<option value="">游戏名称</option>
								<option value="">英雄联盟</option>
								<option value="">刀塔</option>
							</select> 
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label"><font color="red">*</font>所属战队</label>
						<div class="input-group col-sm-5">
							<select class="form-control selectpicker show-tick" name="skillGroupId">
								<option value="">战队名称</option>
								<option value="">战队1</option>
								<option value="">战队2</option>
							</select> 
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label"><font color="red">*</font>头像连接</label>
						<div class="input-group col-sm-5">
							<input type="text" class="form-control" id="agentUserName" name="agentUserName" placeholder="" value="">
						</div>
					</div>
					<div class="form-group">
						<label for="skillGroupDes" class="col-sm-2 control-label"><font color="red">*</font>简介</label>
						<div class="input-group col-sm-5">
							<textarea cols="8" class="form-control" id="Description" name="Description" >简介</textarea>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-primary">提交</button>
							<input type="button" class="btn btn-default" id="back" name="back" onclick="javascript:window.history.go(-1);" value="返回" />
						</div>
					</div>
				</form>
			</div>
		</div>

	</section>
	
	<script>
		$(function(){
			var validateRules = {
				rules : {
					agentUserName : {
						required : true
					},password : {
						required : true
					}
				}
			};
			// 新增操作，增加远程验证
			validateRules.agentNo = {
				required : true,
				remote: {
				    url: "../agentUser/agentNoExist",     //后台处理程序
				    type: "post",               //数据发送方式
				    dataType: "json",           //接受数据格式   
				    data: {                     //要传递的数据
				    	agentNo: function() {
				            return $("#agentNo").val();
				        },
				        agentUserId: function() {
				            return $("#agentUserId").val();
				        }
				    }
				}
			};
			validateRules.agentUserName={
					required : true,	
			};
			validateRules.agentPassword={
					required : true,	
			};
			$("#agentUserForm").validate({
				rules : validateRules,
				messages:{
					agentNo:{
						required :"工号不能为空",
						remote:"该工号已经存在，请修改"
					}
				}
			});
		});
	</script>
</body>
</html>